package sy.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonProperty;

@Entity
@Table(name = "sys_visitor", catalog = "ssh")
public class SysVisitor implements java.io.Serializable{
	private String id;
	private String name;
	private String type;//访客类型：快递，外卖，维修人员，业主友人等
	private String sex;
	private String telephone;
	private String certificateType;//证件类型
	private String cetificateNo;//证件号
	private String timeUnit;//来访时间单位
	private Integer timeNo;//时间长短
	private String carNo;//车牌号
	private Date accessTime;//来访时间
	private Date leaveTime;//来访时间
	private String accessReason;//来访是由
	private String qrCode;//二维码
	private SysAccount sysAccount;//访问业主/承租人id（物业端业主已验证证明字段，存业主账号id）
	private String roomNo;//房号
	private WYAccount registor;//登记人
	private String isYZInvitation;//是否业主来自邀请
	private String doorId;//业主邀请访客时，授予访客的门禁，多个门禁时用逗号隔开
	
	@JsonProperty(value = "sysAccountName")
    private String sysAccountName;
	
	public SysVisitor() {
		super();
	}
	@GenericGenerator(name = "generator", strategy = "uuid.string")
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 64)
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Column(name = "name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "sex")
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name = "telephone")
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "account")
	public SysAccount getSysAccount() {
		return sysAccount;
	}
	public void setSysAccount(SysAccount sysAccount) {
		this.sysAccount = sysAccount;
	}
	@Column(name = "accessTime")
	public Date getAccessTime() {
		return accessTime;
	}
	public void setAccessTime(Date accessTime) {
		this.accessTime = accessTime;
	}
	@Column(name = "accessReason")	
	public String getAccessReason() {
		return accessReason;
	}
	public void setAccessReason(String accessReason) {
		this.accessReason = accessReason;
	}
	@Column(name = "qrCode")
	public String getQrCode() {
		return qrCode;
	}
	public void setQrCode(String qrCode) {
		this.qrCode = qrCode;
	}
	@Column(name = "type")
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	@Column(name = "certificateType")
	public String getCertificateType() {
		return certificateType;
	}
	public void setCertificateType(String certificateType) {
		this.certificateType = certificateType;
	}
	@Column(name = "cetificateNo")
	public String getCetificateNo() {
		return cetificateNo;
	}
	public void setCetificateNo(String cetificateNo) {
		this.cetificateNo = cetificateNo;
	}
	@Column(name = "timeUnit")
	public String getTimeUnit() {
		return timeUnit;
	}
	public void setTimeUnit(String timeUnit) {
		this.timeUnit = timeUnit;
	}
	@Column(name = "timeNo")
	public Integer getTimeNo() {
		return timeNo;
	}
	public void setTimeNo(Integer timeNo) {
		this.timeNo = timeNo;
	}
	@Column(name = "carNo")
	public String getCarNo() {
		return carNo;
	}
	public void setCarNo(String carNo) {
		this.carNo = carNo;
	}
	@Column(name = "roomNo")
	public String getRoomNo() {
		return roomNo;
	}
	public void setRoomNo(String roomNo) {
		this.roomNo = roomNo;
	}
	@Column(name = "leaveTime")	
	public Date getLeaveTime() {
		return leaveTime;
	}
	public void setLeaveTime(Date leaveTime) {
		this.leaveTime = leaveTime;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "registor")
	public WYAccount getRegistor() {
		return registor;
	}
	public void setRegistor(WYAccount registor) {
		this.registor = registor;
	}
	@Column(name = "isYZInvitation")	
	public String getIsYZInvitation() {
		return isYZInvitation;
	}
	public void setIsYZInvitation(String isYZInvitation) {
		this.isYZInvitation = isYZInvitation;
	}
	@Column(name = "doorId")	
	public String getDoorId() {
		return doorId;
	}
	public void setDoorId(String doorId) {
		this.doorId = doorId;
	}
	@Transient
	public String getSysAccountName() {
		return getSysAccount()!=null?getSysAccount().getName():"";
	}

	public void setSysAccountName(String sysAccountName) {
		this.sysAccountName = sysAccountName;
	}
		
}
